﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.WS.UserControls;
using GCELibrary.Current;
using System.Transactions;
using ZF.BLL;
using Newtonsoft.Json;
using ZF.BLL.Admin;
using ZF.BLL.Page;
namespace ZF.WS.Admin
{
 
    public partial class inteset :GMPage
    {
    

        [PageArgument(Key = "id", CanNull = false, BindOperType = PageOperType.Edit)]
        public int MsgId { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
    
            if (!IsPostBack)
            {
                //if (this.OperType == PageOperType.AddNew)
                //    Add();
                //else if (this.OperType == PageOperType.Edit)
                    Edit();
            }
        }
        public void InitControls()
        {

 
        }
 
        public void Edit()
        {
            //using (var dc = BLL.SiteInfo.CreateDBDataContext())
            //{

            //    var msg = dc.E_Msg.FirstOrDefault(p => p.RMemberId == CurrentUser.MemberId && p.MsgId == this.MsgId);
            //    if (msg == null)
            //        throw WarnFactory.CreateWarn(WarnCode.ReocrdNoFind);
            //    InitControls();
            //    this.tbRContent.Text = msg.RContent;
            //    this.tbCType.Text = msg.CType;
            //    this.tbPContent.Text = msg.PContent;
            //    this.tbContact.Text = msg.Contact;
            //}
        }
        public void EditSubmit(object sender, EventArgs e)
        {

            //using (var ts = new System.Transactions.TransactionScope())
            //{
            //    using (var dc = BLL.SiteInfo.CreateDBDataContext())
            //    {
            //        var msg = dc.E_Msg.FirstOrDefault(p => p.RMemberId == CurrentUser.MemberId && p.MsgId == this.MsgId);
            //        if (msg == null)
            //            throw WarnFactory.CreateWarn(WarnCode.ReocrdNoFind);

            //        msg.RContent = this.tbContact.Text;
                 
            //        try
            //        {
            //            SiteInfo.CheckFilterWords(msg);
            //            dc.SubmitChanges();
            //            ts.Complete();
            //        }
            //        catch (Exception ex)
            //        {
            //            throw WarnFactory.CreateWarn(ex);
            //        }
            //        string msgKey = CTitle;


            //        WarnFactory.CreateWarn(new PageWarnParameter()
            //        {
            //            JscriptMode = true,
            //            Link = WarnLink.GoBack,
            //            Message = "操作成功",
            //        }).Alert();

            //        SiteInfo.InsertLog("回复" + msgKey, null);
            //        WarnMessageLink link = new WarnMessageLink(string.Format("成功回复{0}，点击确定按钮返回{0}列表", msgKey));

            //        link.AddWarnMessageLink(string.Format("重新修改{0}", msgKey), Request.Url.ToString());
            //        WarnFactory.CreateWarn(link.ToString(), WarnIcon.Success, ListPage).Alert();

            //    }


            //}

        }

    
    }
 
}
